/*
 * @Author: Troubadour 2276791354@qq.com
 * @Date: 2024-01-11 22:00:13
 * @LastEditors: Troubadour 2276791354@qq.com
 * @LastEditTime: 2024-01-14 19:58:37
 * @FilePath: \MDK-ARMf:\Study\STM32_Project\STM32L051K8U6_Class\SmartHomeEnviromentAssistant\HARDWARE\SoftAnalogIIC\SoftAnalogIIC.h
 * @Description:
 */

#ifndef __SOFTANALOGIIC_H__
#define __SOFTANALOGIIC_H__

#include "main.h"


typedef struct
{
    GPIO_TypeDef *SDA_GPIOx;
    uint16_t SDA_GPIO_Pin;
    GPIO_TypeDef *SCL_GPIOx;
    uint16_t SCL_GPIO_Pin;
}SoftAnalogIIC_Typedef;

typedef enum
{
    IIC_INPUT_MODE = 0,
    IIC_OUTPUT_MODE
}SoftAnalogIIC_PinState;

typedef enum
{
    IIC_OK = 0,
    IIC_ERROR
}SoftAnalogIIC_State;

void SoftAnalogIIC_Init(SoftAnalogIIC_Typedef *pIIC_Struct);
void SoftAnalogIIC_Start(SoftAnalogIIC_Typedef *pIIC_Struct);
void SoftAnalogIIC_Stop(SoftAnalogIIC_Typedef *pIIC_Struct);
SoftAnalogIIC_State SoftAnalogIIC_Wait_Ack(SoftAnalogIIC_Typedef *pIIC_Struct);
void SoftAnalogIIC_Ack(SoftAnalogIIC_Typedef *pIIC_Struct);
void SoftAnalogIIC_NAck(SoftAnalogIIC_Typedef *pIIC_Struct);
void SoftAnalogIIC_Send_Byte(SoftAnalogIIC_Typedef *pIIC_Struct, uint8_t dataByte);
uint8_t SoftAnalogIIC_Read_Byte(SoftAnalogIIC_Typedef *pIIC_Struct, uint8_t ack);


#endif /* __SOFTANALOGIIC_H__*/

